// 以后这个文件专门用来放购物车数据
export default {
  namespaced: true,
  state () {
    return {
      // 购物车数据
      cartList: [
        { id: 1, name: '皮鞋', price: 9.9 },
        { id: 2, name: '凉鞋', price: 7699 },
        { id: 3, name: '外套', price: 2399 },
        { id: 4, name: '斜挎包', price: 17900 }
      ]
    }
  },
  mutations: {
      // 参数1：固定的state，它得到是当前对象里的state
      setCartList (state, list) {
        state.cartList = list
      },
      add () {

        console.log('cart里的add')
    }
  },

  actions: {
    reqCartList () {

      setTimeout(() => {
          console.log('cart里的actions')
      }, 1000);
    }
  }
}
